import request from '@/utils/request'

// 获取监测量库列表
export function getMonitoringLibraryList(params) {
  return request({
    url: '/iot/web/iotMonitoringLibrary/list',
    method: 'get',
    params
  })
}

// 获取监测量类型下拉列表
export function getMonitoringTypeList() {
  return request({
    url: '/iot/web/iotMonitoringLibrary/monitoringTypeList',
    method: 'get'
  })
}

// 获取数据类型下拉列表
export function getValueTypeList() {
  return request({
    url: '/iot/web/iotMonitoringLibrary/valueTypeList',
    method: 'get'
  })
}

// 导出监测量库列表
export function exportMonitoringLibrary(params) {
  return request({
    url: '/iot/web/iotMonitoringLibrary/export',
    method: 'post',
    params,
    responseType: 'blob'
  })
}

// 导入监测量库数据
export function importMonitoringLibrary(data) {
  return request({
    url: '/iot/web/iotMonitoringLibrary/importData',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 下载监测量库模板
export function downloadTemplate() {
  return request({
    url: '/iot/web/iotMonitoringLibrary/importTemplate',
    method: 'post',
    responseType: 'blob'
  })
}

// 获取监测量库详细信息
export function getMonitoringLibraryDetail(monitorId) {
  return request({
    url: `/iot/web/iotMonitoringLibrary/${monitorId}`,
    method: 'get'
  })
}

// 新增监测量库
export function addMonitoringLibrary(data) {
  return request({
    url: '/iot/web/iotMonitoringLibrary',
    method: 'post',
    data
  })
}

// 修改监测量库
export function updateMonitoringLibrary(data) {
  return request({
    url: '/iot/web/iotMonitoringLibrary',
    method: 'put',
    data
  })
}

// 删除监测量库
export function deleteMonitoringLibrary(monitorIds) {
  return request({
    url: `/iot/web/iotMonitoringLibrary/${monitorIds}`,
    method: 'delete'
  })
}

// /web/iotMonitoringLibrary/deviceTypeList 设备类型下拉列表
export function getDeviceTypeList() {
  return request({
    url: '/iot/web/iotMonitoringLibrary/deviceTypeList',
    method: 'get'
  })
}

// /web/iotMonitoringLibrary/deviceList?typeId=${typeId} 获取设备下拉列表
export function getDeviceList(typeId) {
  return request({
    url: `/iot/web/iotMonitoringLibrary/deviceList?typeId=${typeId}`,
    method: 'get'
  })
}

// 获取站点下拉列表
export function getSiteList() {
  return request({
    url: '/iot/web/iotMonitoringLibrary/siteList',
    method: 'get'
  })
} 